package org.vt.eldercare.data;

import org.jfree.data.time.Millisecond;

/**
 * Represents a point of XYZ coordinate data. Stores Value/Time pairs for the X,
 * Y, and Z axis. DataPoints are passed to a graph by the SerialListener.
 * 
 * @author Michael
 * 
 */
public class DataPoint {

	private double accelX;
	private double accelY;
	private double accelZ;
	private double gyroX;
	private double gyroY;
	private double gyroZ;
	private Millisecond time;

	/**
	 * Construct a new DataPoint with the given values.
	 * 
	 * @param accelX
	 * @param xTime
	 * @param accelY
	 * @param yTime
	 * @param accelZ
	 * @param zTime
	 */
	public DataPoint(double accelX, double gyroX, double accelY, double gyroY,
			double accelZ, double gyroZ, Millisecond time) {
		//this.accelX = accelX;
		this.accelX = (accelX - 512)/158;
		this.accelY = (accelY - 512)/158;
		this.accelZ = (accelZ - 512)/158;
		this.gyroX = gyroX;
		this.gyroY = gyroY;
		this.gyroZ = gyroZ;
		this.time = time;
	}

	public double getGyroX() {
		return gyroX;
	}

	public double getGyroY() {
		return gyroY;
	}

	public double getGyroZ() {
		return gyroZ;
	}

	public double getAccelX() {
		return accelX;
	}

	public double getAccelY() {
		return accelY;
	}

	public double getAccelZ() {
		return accelZ;
	}

	public Millisecond getTime() {
		return time;
	}

	public String dataToString() {
		return time.toString() + "\t" + accelX + "\t" + accelY + "\t" + accelZ
				+ "\t" + gyroX + "\t" + gyroY + "\t" + gyroZ;
	}

}
